package com.cartel.genius.dao;

import com.cartel.genius.dao.exceptions.CategoryExistsException;
import com.cartel.genius.dao.exceptions.CategoryNotFoundException;
import com.cartel.genius.dao.exceptions.CategoryParentNotFoundException;
import com.cartel.genius.dto.CategoryTO;

/**
 * DAO class for Category (place divisions) operations
 * 
 * @author Naresh Reddy
 */
public interface CategoryDAO {
	
	/**
	 * Method to add root level category. All other categories will be childs of this category.
	 * 
	 * @param categoryName
	 * @return CategoryTO
	 * @throws CategoryExistsException
	 */
	public CategoryTO addRootCategory(String categoryName) throws CategoryExistsException;
	
	/**
	 * Method to add child category under specified parent
	 * @param categoryName
	 * @param parentCategory
	 * @return CategoryTO
	 * @throws CategoryExistsException
	 */
	public CategoryTO addCategory(String categoryName, CategoryTO parentCategory) throws CategoryExistsException, CategoryParentNotFoundException;
	
	/**
	 * Method to modify category (should be used for modifying category name)
	 * @param category
	 * @return CategoryTO
	 * @throws CategoryNotFoundException
	 */
	public CategoryTO modifyCategory(CategoryTO category) throws CategoryNotFoundException;
	
	/**
	 * Method to modify category hierarchy
	 * @param categoryName
	 * @param oldParentId
	 * @param newParentId
	 * @return CategoryTO
	 * @throws CategoryNotFoundException
	 * @throws CategoryParentNotFoundException
	 */
	public CategoryTO modifyCategory(String categoryName, int oldParentId, int newParentId) throws CategoryNotFoundException, CategoryParentNotFoundException;
	
	/**
	 * Method to remove a Category from system
	 * @param categoryId
	 * @return boolean
	 * @throws CategoryNotFoundException
	 */
	public boolean removeCategory(int categoryId) throws CategoryNotFoundException;
	
	/**
	 * Method to remove a Category from system
	 * @param category
	 * @return boolean
	 * @throws CategoryNotFoundException
	 */
	public boolean removeCategory(CategoryTO category) throws CategoryNotFoundException;

}
